using System;
using Science.Mathematics;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter02
{
	/// <summary>
	/// Example10: Describing the Motion of a Tossed Ball
	/// A ball is tossed straight up at 25 m/s. Estimate its 
	/// velocity at 1-s intervals.
	/// </summary>
	public class Example10
	{
		public Example10()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Vector.FunctionOfTime VelocityTime
				= new L.Vector.FunctionOfTime(Func);
			L.Velocity v = new L.Velocity();
            v.VectorFunctionOfTime = VelocityTime;
            L.Time t = new L.Time();
            for (int i = 0; i < 7; i++)
            {
                t.s = (double) i;
                v.Set(t);
                result += v.Z.ToString() + "\r\n";
            }
		}
		private L.Vector Func(L.Time t)
		{
			L.Vector h = new L.Vector();
			h.X = 0.0;
			h.Y = 0.0;
			h.Z = 25.0 - L.Constant.AccelerationOfGravity*t.s;
			return h;
		}
	}
}
